<template>
    <div>


    <input type="text" v-model='name'>
    <input type="text" v-model='password'>

    <Button color="red" @click="Login">get请求</Button>
    <Button color="red" @click="Loginone">post请求</Button>
    
    </div>
</template>
    
<script>
import {login,login_post} from '../api/api'
    export default {
        data(){
            return {
                msg:'你好，这里是首页',
                name:'',
                password:''

                    
            }
        },
        //定义组建标签
        components:{

        },
        filters: {
     
　　    },
        //自定义方法
        methods:{
            Login:function(){
                var params = {'name': this.name, 'password': this.password}
                login(params).then( res => {
                    console.log(res)
       
                })
            },
            Loginone:function(){
                var data={'name': this.name, 'password': this.password}
                login_post(data).then( res => {
                    console.log(res)
       
                })
            },
    
        },
        //钩子方法
        mounted:function(){
    
            console.log('这是初始化方法');

      
    
        },
        //监听属性
        watch:{
    
    
        },
        //计算属性
        computed:{
    
    
        }
    
    
    
    }
    
    
</script>
    
<style>
    
</style>

